#define _CRT_SECURE_NO_WARNINGS

#include "logging.h"
#include "config.h"
#include "telnet.h"
#include "files_and_reply.h"
#include "connections.h"

#include <WinSock2.h>
#include <Ws2tcpip.h>
#include <stdio.h>

#pragma comment(lib, "ws2_32.lib")

void initiateSocket(serverValueT serverValue);
void initiateServer(serverValueT serverValue);
void printIntroMessage(void);



int main(void){
	WSADATA wsaData;
	int iResult;

	iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
	if (iResult != 0){
		printf("WSAStartup failed: %d\n", iResult);
		return 1;
	}
	initiliseLogging("logFile.txt" , "ab+" );
	initFilesAndReply();
	printIntroMessage();
	startServer();
	waitForAdminConnections();
}

/*
* Function: printIntroMessage
* Usage: printIntroMessage();
* ------------------------------------------
* This function prints the intro/welcome message for the user.
*/
void printIntroMessage(void){
	printf("This server was written by Tobias Anhed(S142015), Thires Nilsson(S143979), \nHenrik Wistbacka(S142066), Alexander Pihl(S143192) and Joakim Akerstrom(S142294)\n");
}



